import request from '@/utils/request'

export const articleListAPI = params => {
  return request({
    url: '/v1_0/articles',
    params
  })
}

// 封装一个获取文章详情的接口
export const detailAPI = id => {
  return request({
    url: '/v1_0/articles/' + id
  })
}

// 封装一个关注作者的接口
export const followArticle = userId => {
  return request({
    url: '/v1_0/user/followings',
    method: 'post',
    data: {
      target: userId
    }
  })
}

// 封装一个取消关注作者的接口
export const unFollowArticle = userId => {
  return request({
    url: `/v1_0/user/followings/${userId}`,
    method: 'delete'
  })
}

// 封装一个不敢兴趣的接口
export const articleDislike = artID => {
  return request({
    url: '/v1_0/article/dislikes',
    method: 'post',
    data:{
      target:artID
    }
  })
}

// 封装一个点赞的接口
export const articleLikings = (artID) => {
  return request({
    url:'/v1_0/article/likings',
    method:'post',
    data:{
      target:artID
    }
  })
}
